/**
 * 性别
 */
const gender = [
    { key: 'MALE', value: 1, label: '男' },
    { key: 'FEMALE', value: 0, label: '女' },
];

/**
 * 转换类型为常量map
 * @param {Array} list
 */
function ParseConst(list) {
    let map = {};
    for (let i = 0; i < list.length; i++) {
        map[list[i].key] = list[i].value;
    }
    return map;
}
/**
 * 获取常量描述
 * @param {Array} list
 * @param {any} type
 */
export function getConstLabel(list, type) {
    for (let i = 0; i < list.length; i++) {
        if (list[i].value === type) {
            return list[i].label;
        }
    }
    return '';
}

export default {
    // 性别
    GENDER_LIST: gender,
    GENDER: ParseConst(gender),
};
